{extend name="public/base" /}

{block name="title"}<title>课程列表</title>{/block}

{block name="pjax_container"}
<style>
tr>th,td{
    text-align: center;

}
 
.content-header>.breadcrumb>li{
    color: #999;
}
.content-header>.breadcrumb>.active{
    color: #666;
}
.content-header{
    height: 51px;
 
}
.btn-primary{
      background-color: #1890FF;
    color: #fff;
    border: none;
    border-radius: 6px !important;
    margin-left: 15px;
    padding: 5px 10px; 
}
.box-primary{
  border-top-color: #ecf0f5 !important;
  border-top-width: 16px;
  
}
.btn-primary:hover{
     background-color: #1890FF;
    color: #fff;
    border: none;
    opacity: .9;
    border-radius: 6px !important; 
}
.delete-one{
    background-color: ff4141 !important;
    margin-left: 15px;
    border-radius: 6px;
    padding: 5px 8px;
}
.sreachs{
       background-color: #1890FF;
    color: #fff;
    border: none;
    border-radius: 6px !important;
    margin-left: 15px;
    padding: 7px 15px; 
}
</style>
<section class="content-header">
    <ol class="breadcrumb">
        <li>商城管理</li>
        <li class="active">课程列表</li>
    </ol>
</section>
<section class="content">
    <div class="row">
        <div class="col-md-12">
            <div class="box box-primary">

                {include file="form_search/search_course" /}
                <div class="box-header with-border">
                    <div class="pull-left">
                        {:authAction(CONTROLLER_NAME.'/course_edit','create')}
                        {:authAction(CONTROLLER_NAME.'/course_del','delete_all')}
                    </div>
                </div>
                <div class="box-body table-responsive">
                    <table class="table table-bordered table-hover">
                        <tr>
                            <th width="35"><input type="checkbox" class="minimal checkbox-toggle"></th>
                            <th>ID</th>
                            <th>课程名称</th>
                            <th>课程型号</th>
                            <th>课程时间</th>
                            <th>封面图</th>
                            <th>单价</th>
                            <th>排序</th>
                            <th>状态</th>
                            <th>创建时间</th>
                            <th>操作</th>
                        </tr>
                        {volist name="$list" id="v"}
                        <tr>
                            <td><input type="checkbox" name="id[]" value="{$v.id}" class="minimal checkbox"></td>
                            <td>{$v["id"]}</td>
                            <td>{$v["name"]}</td>
                            <td>{:trim($course_model_names[$v["id"]]??'',',')}</td>
                            <td>{:date('Y-m-d H:i',$v["course_time"])}</td>
                            <td><img src="{$v.image}" style="width: 100px;height: 100px;"></td>
                            <td>{$v["price"]}</td>
                            <td>{$v["sort"]}</td>
                            <td style="vertical-align:middle">
                                <a href="javascript:void(0);" data-id="{$v['id']}" data-field="status"
                                   data-value="{$v['status']}" data-url="{:url('course_status', ['id'=>$v['id']])}"
                                   class='editimg fa {if condition="$v.status == 1 "}fa-check-circle text-green{else /}fa-times-circle text-red{/if}'></a>
                            </td>
                            <td>{:date('Y-m-d H:i',$v["create_time"])}</td>
                            <td>
                                {:authAction(CONTROLLER_NAME.'/course_edit','edit',['id'=>$v['id']])}
                                {:authAction(CONTROLLER_NAME.'/course_del','delete_one',['id'=>$v['id']])}
                            </td>
                        </tr>
                        {/volist}
                    </table>
                </div>
                <div class="box-footer clearfix">
                    {$list->render()}
                </div>
            </div>
        </div>
    </div>
</section>
<script>
    $(function(){
        // 列表部分 全选
        $('input[type="checkbox"].minimal, input[type="radio"].minimal').iCheck({
            checkboxClass: 'icheckbox_minimal-blue',
            radioClass: 'iradio_minimal-blue'
        });
        $('.checkbox-toggle').on('ifChecked', function(event){
            var _this = $(this);
            var _table = _this.closest('.table');
            _table.find("tr td input[type='checkbox']").iCheck("check");
        });
        $('.checkbox-toggle').on('ifUnchecked', function(event){
            var _this = $(this);
            var _table = _this.closest('.table');
            _table.find("tr td input[type='checkbox']").iCheck("uncheck");
        });
    });
</script>
{/block}
